import request from "@/utils/request";

/**
 * 产品类型-列表
 * @param {*} data
 */
export function getProtypeList(param) {
  const { pageNum, pageSize, ...data } = param;
  return request({
    url: `/gongyuan/producttype/list?pageNum=${pageNum}&pageSize=${pageSize}`,
    method: "post",
    data
  });
}

/**
 * 产品类型-根据ID查询
 * @param {*} id
 */
export function getProtypeDetail(id) {
  return request({
    url: `gongyuan/producttype/${id}`,
    method: "get"
  });
}

/**
 * 产品类型-删除
 * @param {*} id
 */
export function delProtype(id) {
  return request({
    url: `gongyuan/producttype/${id}`,
    method: "delete"
  });
}

/**
 * 产品类型-添加
 * @param {*} data
 */
export function addProtype(data) {
  const { url, ...other } = data;
  return request({
    url: "/gongyuan/producttype",
    method: "post",
    data: {
      url: JSON.stringify(url),
      ...other
    }
  });
}

/**
 * 产品类型-更新
 * @param {*} data
 */
export function updateProtype(data) {
  const { url, ...other } = data;
  return request({
    url: "/gongyuan/producttype",
    method: "put",
    data: {
      url: JSON.stringify(url),
      ...other
    }
  });
}
